<?php

namespace app\model;

use think\Model;

class Games extends Model
{

    static function createOneGame($param){

        $rand_coins=randMoney($param['coins'],$param['redcount']);
        shuffle($rand_coins);
        $rand_coins_str = json_encode($rand_coins);
        $time=time();
        $data['uid']=$param['uid'];
        $data['rid']=$param['rid'];
        $data['coins']=$param['coins'];
        $data['redcount']=$param['redcount'];
        $data['lei']=$param['lei'];
        $data['create_time']=$time;
        $data['rand_coins']=$rand_coins_str;
        return self::create($data);
    }
    
}
